package com.hl.web.fore;

import com.hl.pojo.Company;
import com.hl.pojo.Reply;
import com.hl.service.CompanyService;
import com.hl.service.ReplyService;
import com.hl.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
    @RequestMapping("/company")
public class CompanyController {
    @Autowired
    private CompanyService companyService;
    @GetMapping("/findAll")
    public ResultEntity findAll(){
        return ResultEntity.ok(companyService.findAll());
    }
    @GetMapping("/findAll1")
    public ResultEntity findAll1(){
        return ResultEntity.ok(companyService.findAll1());
    }
    @GetMapping("/findAll2")
    public ResultEntity findAll2(String name){
        return ResultEntity.ok(companyService.findAll2(name));
    }
    @GetMapping("/findById")
    public ResultEntity findById(Integer id){
        return ResultEntity.ok(companyService.findById(id)) ;
    }
    @GetMapping("/delete")
    public ResultEntity delete(Integer id){
         companyService.delete(id);
        return ResultEntity.ok();
    }
    @PostMapping("/add")
    public ResultEntity add(@RequestBody Company company){
         companyService.add(company);
        return ResultEntity.ok();
    }
    @PostMapping("/update")
    public ResultEntity update(@RequestBody Company company){
         companyService.update(company);
        return ResultEntity.ok();
    }
}
